use UMAS0007_OUTPUT.DTA, clear

svyset [pw=weight]


*REGION
gen region=1 if inputstate==9 | inputstate==23 | inputstate==25 | inputstate==33 | inputstate==44 | inputstate==50 | inputstate==34 | inputstate==36 | inputstate==42 
replace region=2 if inputstate==18 | inputstate==17 | inputstate==26 | inputstate==39 | inputstate==55 | inputstate==19 | inputstate==20 | inputstate==27 | inputstate==29 | inputstate==31 | inputstate==38 | inputstate==46
replace region=3 if inputstate==10 | inputstate==11 | inputstate==12 | inputstate==13 | inputstate==24 | inputstate==37 | inputstate==45 | inputstate==51 | inputstate==54 | inputstate==1 | inputstate==21 | inputstate==28 | inputstate==47 | inputstate==5 | inputstate==22 | inputstate==40 | inputstate==48 
replace region=4 if inputstate==4 | inputstate==8 | inputstate==16 | inputstate==35 | inputstate==30 | inputstate==49 | inputstate==32 | inputstate==56 | inputstate==2 | inputstate==6 | inputstate==15 | inputstate==41 | inputstate==53
label var region "region"
label define regionlabel 1 "Northeast" 2 "Midwest" 3 "South" 4 "West"
label val region regionlabel

*BORDER STATES
gen borderstate=1 if inputstate==12 | inputstate==48 | inputstate==4 | inputstate==35 | inputstate==6
recode borderstate .=0
label define bslabel 1 "Border state" 0 "Non-border state"
label val borderstate bslabel


recode Q1_1-Q1_10 (.=9)

* Approval
svy: tab Q22_a
svy: tab Q22_b
svy: tab Q22_e
svy: tab Q22_f

* Ranking of issues
svy: tab Q1_1
svy: tab Q1_2
svy: tab Q1_3
svy: tab Q1_4
svy: tab Q1_5
svy: tab Q1_6
svy: tab Q1_7
svy: tab Q1_8
svy: tab Q1_9
svy: tab Q1_10

recode Q2_cents_d Q3_cents_d (.=0)
gen minwagecurrent=Q2_dollars_d+(Q2_cents_d/100)
gen minwagepref=Q3_dollars_d+(Q3_cents_d/100)

twoway histogram minwagecurrent, scheme(s1color) bc(blue) discrete percent xlabel(0 5 "$5" 7.25 "$7.25" 10 "$10" 15 "$15" 20 "$20") text(25 7.25 "Correct answer", size(vsmall)) xtitle("How much is federal minimum wage?") aspect(.2) 
graph export minwagecurrent.eps, preview(on) replace

twoway histogram minwagepref, scheme(s1color) bc(blue) discrete percent xlabel(0 5 "$5" 7.25 "$7.25" 10 "$10" 15 "$15" 20 "$20") xtitle("How much should federal minimum wage be?") aspect(.2)
graph export minwagepref.eps, preview(on) replace


* Voting lines
svy: tab Q15 Q15rand, col  stubw(50)

* 

* Gun control
svy: proportion Q8, over(Q8rand)
parmest, saving(guncontrol1, replace)
svy: proportion Q8, over(gender Q8rand)
parmest, saving(guncontrol2, replace)




* Immigration

twoway histogram Q5, ylabel(0 2 4 6) scheme(s1color) bc(blue) discrete percent xlabel(0 "None" 1000000 "1 million" 2000000 "2 million" 3000000 "3 million" 4000000 "4 million" 5000000 "5 million       " )xtitle("How many illegal immigrants in 2012?") aspect(.2)
graph export illegals2012.eps, preview(on) replace

twoway histogram Q4, ylabel(0 2 4 6)  scheme(s1color) bc(blue) discrete percent xlabel(0 "None" 1000000 "1 million" 2000000 "2 million" 3000000 "3 million" 4000000 "4 million" 5000000 "5 million       " ) xtitle("How many legal immigrants in 2012?") aspect(.2)
graph export legals2012.eps, preview(on) replace


twoway histogram Q6, ylabel(0 2 4 6)  scheme(s1color) bc(blue) discrete percent xlabel(0 "None" 1000000 "1 million" 2000000 "2 million" 3000000 "3 million" 4000000 "4 million" 5000000 "5 million       " ) xtitle("How many legal immigrants should be allowed?") aspect(.2)
graph export legalspref.eps, preview(on) replace


svy: tab Q7_a
svy: tab Q7_b
svy: tab Q7_c
svy: tab Q7_d
svy: tab Q7_e

